
/*
 * =====================================================================================
 *
 *       Filename:  SessionCache.h
 *
 *    Description:
 *
 *        Version:  1.0
 *        Created:  03/06/19 15:59:04
 *       Revision:  none
 *       Compiler:  gcc
 *
 *         Author:  liushuyong (), shuyong1999@163.com
 *        Company:  shuyong
 *
 * =====================================================================================
 */

#ifndef  TTSServiceImpl_H_
#define  TTSServiceImpl_H_

#include <iostream>
#include <sstream>
#include <string>

#include "gflags/gflags.h"
#include "butil/logging.h"
#include "butil/time.h"
#include "brpc/channel.h"
#include "brpc/server.h"
#include "brpc/restful.h"
#include "IHttp.pb.h"

using std::string;
using std::cout;
using std::endl;
using google::protobuf::RpcController;
using google::protobuf::Closure;

//继承http.procto生成的类
class TTSServiceImpl: public IHttp {
  public:
    TTSServiceImpl();
    virtual ~ TTSServiceImpl();
    static TTSServiceImpl* getInstance();
    string getTTSEngineVersion();
    static bool loadResouce(const string& modelPath);

  private:
    void onTTS(RpcController* cntl_base, const HttpRequest* request, HttpResponse* response, Closure* done);
    void onCmd(RpcController* controller, const::CmdReq* request, ::CmdRsp* response, Closure* done);
    void onStatus(RpcController* controller, const::StatusReq* request, ::StatusRsp* response, Closure* done);

  private:
    static TTSServiceImpl* gmInstance;  //单例
    string mTTSEngineVersion;
};

#endif
